package com.kaigejava.command.command;

import com.kaigejava.command.command.impl.CommandModeControl;
import com.kaigejava.command.command.impl.light.LightOffCommand;
import com.kaigejava.command.command.impl.light.LightOnCommand;
import com.kaigejava.command.command.impl.stereo.StereoOffCommand;
import com.kaigejava.command.command.impl.stereo.StereoOnCommand;
import com.kaigejava.command.command.impl.stereo.vol.StereoAddVolCommand;
import com.kaigejava.command.command.impl.stereo.vol.StereoSubVolCommand;
import com.kaigejava.command.sdk.LightAPI;
import com.kaigejava.command.sdk.StereoAPI;

/**
 * Created by kaigejava on 2019/8/30.
 */
public class ControlTest {
    public static void main(String[] args) {
        CommandModeControl control = new CommandModeControl();
        MarcoCommand onmarco,offmarco;
        LightAPI bedroomlight = new LightAPI("卧室");
        LightAPI kitchlight = new LightAPI("厨房");
        StereoAPI stereo = new StereoAPI();



        LightOnCommand bedroomlighton = new LightOnCommand(bedroomlight);
        LightOffCommand bedroomlightoff = new LightOffCommand(bedroomlight);
        LightOnCommand kitchlighton = new LightOnCommand(kitchlight);
        LightOffCommand kitchlightoff = new LightOffCommand(kitchlight);

        ICommandInterface[] oncommands={bedroomlighton,kitchlighton};
        ICommandInterface[] offcommands={bedroomlightoff,kitchlightoff};

        onmarco=new MarcoCommand(oncommands);
        offmarco=new MarcoCommand(offcommands);

        StereoOnCommand stereoOn = new StereoOnCommand(stereo);
        StereoOffCommand stereoOff = new StereoOffCommand(stereo);
        StereoAddVolCommand stereoaddvol = new StereoAddVolCommand(stereo);
        StereoSubVolCommand stereosubvol = new StereoSubVolCommand(stereo);

        control.setCommand(0, bedroomlighton, bedroomlightoff);
        control.setCommand(1, kitchlighton, kitchlightoff);
        control.setCommand(2, stereoOn, stereoOff);
        control.setCommand(3, stereoaddvol, stereosubvol);
        control.setCommand(4, onmarco, offmarco);

        control.onButton(0);
        control.undoButton();
        //control.offButton(0);
        control.onButton(1);
        control.offButton(1);
        control.onButton(2);
        control.onButton(3);

        control.offButton(3);
        control.undoButton();
        control.offButton(2);
        control.undoButton();
        control.onButton(4);
        control.offButton(4);
    }

}
